AltME groups: search
Help · search scripts · search articles · search mailing listresults summary
world | hits |
r4wp | 5 |
r3wp | 15 |
total: | 20 |
results window for this page: [start: 1 end: 20]
world-name: r4wp
Group: #Red ... Red language group [web-public] | ||
Arnold: 15-Jun-2013 | I can specify Release or Debug. I used the Debug up till now. loop 1000 times Red/System script real 0m18.446s user 0m18.385s sys 0m0.023s Then I have real 0m2.424s user 0m2.405s sys 0m0.006s My C is not what is used to be. No doubechecked should do same loop. Well if this is the case there is some improvement ahead. | |
Arnold: 16-Jun-2013 | Thanks for the compliment Doc, not really sure what you mean exactly by making it more like Red/System and less C: use more descriptive names? I will take a closer look at some ed/System examples out there. Thanks Kaj for finding those and for the tips, the size of MM makes it the same in effect in this case, but it has to be <= then. Program not crashing, I was lucky then! off-by-one errors? My index goes from 1 up, where in C it is from 0 up, I had to debug this to make sure elements were swapped in the same way as in the original program. That is also why I declare KKP and LLP to as to save from adding 1 to KK and LL over and over again. Knuth's algorythm was the first one I found, and I knew already of its existence, so it made sense to use what you have. Sure my Red/System code is not optimised. Going to work on it now and tomorrow, and later I take on the Twister. It is a good exercise! | |
Bo: 26-Jun-2013 | I have this bit of Red/System code that I wrote, but for some reason, it just closes the console window. So I don't know if there is an error, and if there was, how would I debug it? #include %../C-library/ANSI.reds img1: as-binary 0 size1: 0 img2: as-binary 0 size2: 0 img1: read-file-binary "img1.bin" :size1 print-line img1 print-line size1 print-line as integer! img1/1 img2: read-file-binary "img2.bin" :size2 print-line img2 print-line size2 img3: as-binary size1 i: 0 until [ i: i + 1 img3/i: img2/i - img1/i i = size1 ] write-file-binary "img3.bin" img3 size1 until [no] | |
Kaj: 7-Jul-2013 | Red/System [] #import ["ntoskrnl.exe" stdcall [ log-error: "DbgPrint" [ "Print formatted message to debug log." [variadic] ; format [c-string!] ; value [variant!] ; ... ] ]] on-load: function ["DriverEntry" DriverObject [driver-object!] RegistryPath [byte-ptr!] return: [integer!] ][ log-error "Hello Red/System from Windows kernel driver!" 0 ] | |
Group: !REBOL3 ... General discussion about REBOL 3 [web-public] | ||
AdrianS: 22-Feb-2013 | Actually, to keep things as simple as possible for people, all you need is Code::Blocks, the CB project file and a slightly modified make-make.r that is soon to be checked in by Andreas (or which I could provide). Then, you can build from CB (and debug), navigate your C source propertly, etc. |
world-name: r3wp
Group: Ann-Reply ... Reply to Announce group [web-public] | ||
AdrianS: 4-Jun-2010 | Yeah, most extensions probably wouldn't involve too many files to manage and code should be easy to debug by printing to output. I never looked at D closely, but it does seem to be a really nice alternative to using C/C++. | |
Group: I'm new ... Ask any question, and a helpful person will try to answer. [web-public] | ||
mhinson: 18-Apr-2009 | I have written my first bit of code that is starting to do something useful. All the bad bits are mine & all the good bits are from the help I have been given here. My main intention is to start off with code that I can understand & develop so any criticism would be most welcome. My next step is to remove the debug code & replace it with code that stores all the information in a structured form for searching & further analysis. Thanks for all your help with this. filename: copy %/c/temp/cisco.txt ;; cisco config file host: copy [] interface: copy [] intDescription: copy [] intIpAddress: [] ipRoute: [] IntFlag: false spacer: charset " ^/" name-char: complement spacer lines: read/lines filename foreach line lines [ ;; move through lines parse/all line [copy temp ["interface" to end] ( ;; evaluated if "interface" found preceeded by nothing else interface: copy temp print interface ;; debug code IntFlag: true) | copy temp2 [" desc" to end] ( ;; evaluate if " desc" found preceeded by nothing else if IntFlag [print temp2] ;; debug ) | copy temp3 [" ip address" to end] ( ;; " ip address" print temp3 ;; debug ) | copy temp4 ["hostname" to end] ( ;; "hostname" print temp4 ;; debug ) | copy temp5 [name-char to end] ( ;; any char except space or newline. this must be last ; if IntFlag [print temp5] ;; debug if IntFlag [print "!"] ;; debug IntFlag: false ) ] ] ;###################################### the input file contains these lines which are extracted (except the !) plus it has a load more lines that are ignored at the moment. hostname pig interface Null0 ! interface Loopback58 description SLA changed this ! interface ATM0 ! interface ATM0.1 point-to-point ! interface FastEthernet0 description my first port ! interface FastEthernet1 description test1 ! interface FastEthernet2 description test2 ! interface FastEthernet3 ! interface Dot11Radio0 ! interface Vlan1 description User vlan (only 1 vlan allowed) ! interface Dialer0 description $FW_OUTSIDE$ ip address negotiated ! interface BVI1 description $FW_INSIDE$ ip address 192.168.0.1 255.255.255.0 ! !########### end ########## | |
mhinson: 19-Apr-2009 | I have tried to understand & take on what I have been told, thanks. Is this worse or better. It does what I was looking to do & I know how to extend it in the same structure. I am sure it would be educational for me if anyone has time to tear it to shreds please. Should I stop using read/line now? Would I get the benefit still? Or is the requirement too fragmented for this approach now? Should I use functions anywhere instead? Have I initialised my variables in the right & appropriate way? filename: copy %/c/temp/cisco.txt ;; cisco config file outFile: copy %/c/temp/outFile.log ;; tab separated output hostname: copy [] interface: copy [] intDesc: copy [] intIpaddr: [] ipRoute: [] IntFlag: false spacer: charset " ^/" name-char: complement spacer lines: read/lines filename outInterface: [ write/append outFile reduce [filename tab i tab hostname tab interface tab intDesc tab intIpaddr newline] ] clearInterface: [ interface: copy [] intDesc: copy [] intIpaddr: [] ] interfaceRule: [ ["interface " copy temp-interface to end] ( ;; captures point-point as well if IntFlag outInterface ;; start of new interface section so output data collected previously. if IntFlag clearInterface interface: copy temp-interface print ["! found at line " i] ;; debug print current-line ;; debug IntFlag: true ) ] descRule: [ [" description " copy intDesc to end] ( if IntFlag [print current-line] ;; debug ) ] ipAddrRule: [[" ip address " copy intIpaddr to end] ( print current-line ;; debug ) ] hostnameRule: [["hostname " copy hostname to end] ( ;; "hostname" print current-line ;; debug ) ] iprouteRule: [copy iproute ["ip route" to end] ( ;; "ip route" print current-line ;; debug ) ] IntFlagRule: [copy tempZZ [name-char to end] ( ;; not space or newline. this must be out of the int section if IntFlag outInterface ;; end of interface section so output data collected. if IntFlag clearInterface if IntFlag [print "!"] ;; debug IntFlag: false ;; ) ] i: 0 foreach line lines [i: i + 1 ;; move through lines & track line number current-line: line ;; for debug output parse/all line [ ;; parse only using rules below interfaceRule ;; evaluated if "interface" found preceeded by nothing else | descRule ;; evaluate if " desc" found preceeded by nothing else | ipAddrRule ;; " ip address" | hostnameRule ;; " hostname" | iprouteRule ;; "ip route" | IntFlagRule ;; unset interface flag if no longer in interface section (no " ^/") ] ] | |
mhinson: 13-Jun-2009 | Hi, I have written this function and would be glad of any comments please. I know it is only simple stuff but I want to try any learn to write code well, not just hack stuff together that just about works. Thanks. ;; Generate all IPv4 dotted decimal masks AllMasks: has [a b c d allMasks][ allMasks: [] if (allMasks = []) [ for count 0 7 1 [ i: to-integer power 2 (count) a: 255.255.255.255 - to-tuple rejoin ["0.0.0." (i - 1) ""] b: 255.255.255.255 - to-tuple rejoin ["0.0." (i - 1) ".255"] c: 255.255.255.255 - to-tuple rejoin ["0." (i - 1) ".255.255"] d: 255.255.255.255 - to-tuple rejoin ["" (i - 1) ".255.255.255"] insert allMasks reduce [a b c d] ] sort/all/reverse allMasks insert tail allMasks 0.0.0.0 print "Created all IPv4 masks" ;; debug ] return allMasks ] | |
Group: !RebGUI ... A lightweight alternative to VID [web-public] | ||
Robert: 16-Apr-2006 | Here is a short example when it fails: rebol [] ;--- Startup if system/product == 'Link [ attempt [call reduce ["d:\rebol\view\rebol.exe" system/script/header/file] quit] attempt [call reduce ["c:\programme\rebol\view\rebview.exe" system/script/header/file] quit] attempt [call reduce ["c:\rebol\view\rebol.exe" system/script/header/file] quit] quit ] ;-- use xpeers framework structure link-root: first split-path system/script/path link-root: copy/part link-root index? find link-root "/xpeers/" append link-root %xpeers/ do link-root/framework/anamonitor300.r do link-root/framework/slim.r ;-- RebGUI stuff #include %rebgui.r unless value? 'ctx-rebgui [do link-root/framework/libraries/rebgui.r] ;-- SLIM stuff slim/open 'debug none ; [mark-my-words] ; mark-my-words/init unit-size: 4 font-size: 12 tab-size: 120x55 display/min-size "CalcIT" compose/deep [ label "Land" drop-list 60 data ["A" "B"] return ] 1024x768 do-events halt | |
Group: SVG Renderer ... SVG rendering in Draw AGG [web-public] | ||
shadwolf: 23-Jun-2005 | REBOL [ Title: "SVG Demo" Owner: "Ashley G. Trüter" Version: 0.0.1 Date: 21-Jun-2005 Purpose: "Loads and displays a resizeable SVG file." History: { 0.0.1 Initial release } Notes: { Tested on very simple SVG icons Only a few basic styles / attributes / commands supported Does not handle sizes in units other than pixels (e.g. pt, in, cm, mm, etc) SVG path has an optional close command, "z" ... AGG shape equivalent auto-closes load-svg function needs to be totally refactored / optimized ... *sample only* } ] ; The following commands are available for path data: ; ; M = moveto ; L = lineto ; H = horizontal lineto ; V = vertical lineto ; C = curveto ; S = smooth curveto ; Q = quadratic Belzier curve ; T = smooth quadratic Belzier curveto ; A = elliptical Arc ; Z = closepath ;print: none ; comment out this line to enable debug messages load-svg: function [svg-file [file! string!] size [pair!]] [ id defs x y to-color to-byte draw-blk append-style svg-size scale-x scale-y ][ xml: either string? svg-file [parse-xml svg-file] [ unless %.svg = suffix? svg-file [to error! "File has an invalid suffix!"] parse-xml read svg-file ] unless xml/3/1/1 = "svg" [to error! "Could not find SVG header!"] ;unless find ["id" "xmlns"] xml/3/1/2/1 [to error! "Could not find ID header!"] ;unless xml/3/1/3/1/1 = "defs" [to error! "Could not find DEFS header!"] id: xml/3/1/2 defs: xml/3/1/3 ; ; --- Parse SVG id ; svg-size: either find ["32pt" "48pt" "72pt"] select id "width" [ switch select id "width" [ "72pt" [120x120] "48pt" [80x80] "32pt" [60x60] ] ][ as-pair to integer! any [select id "width" "100"] to integer! any [select id "height" "100"] ] x: to integer! any [select id "x" "0"] y: to integer! any [select id "y" "0"] scale-x: size/x / svg-size/x scale-y: size/y / svg-size/y ; ; --- Helper functions ; to-color: func [s [string!]] [ ; converts a string in the form "#FFFFFF" to a 4-byte tuple to tuple! load rejoin ["#{" next s "00}"] ] to-byte: func [s [string!]] [ ; converts a string with a value 0-1 to an inverted byte 255 - to integer! 255 * to decimal! s ] ; ; --- Parse SVG defs ; draw-blk: copy [] append-style: function [ command [string!] blk [block!] ][ x xy pen-color fill-color line-width mode size radius shape closed? matrix transf-command ][ xy: 0x0 size: 0x0 line-width: 1 matrice: make block! [] radius: none transf-command: none foreach [attr val] blk [ switch attr [ "transform" [print "tranform have been found" ;probe val halt val: parse val "()," transf-command: first val probe transf-command switch transf-command [ "matrix" [ foreach word val [ if not find word "matrix" [ insert tail matrice to-decimal word ] ] ] ] ] "style" [ foreach [attr val] parse val ":;" [ switch/default attr [ "font-size" [ ] "stroke" [ switch/default first val [ #"#" [pen-color: to-color val] #"n" [pen-color: none] ][ print ["Unknown stroke:" val] ] ] "stroke-width" [line-width: to decimal! val] "fill" [ fill-color: switch/default first val [ #"#" [to-color val] #"n" [none] ][ print ["Unknown fill value:" val] none ] ] "fill-rule" [ mode: switch/default val [ "evenodd" ['even-odd] ][ print ["Unknown fill-rule value:" val] none ] ] "stroke-opacity" [pen-color: any [pen-color 0.0.0.0] pen-color/4: to-byte val] "fill-opacity" [fill-color: any [fill-color 0.0.0.0] fill-color/4: to-byte val] "stroke-linejoin" [ insert tail draw-blk switch/default val [ "miter" [compose [line-join miter]] "round" [compose [line-join round]] "bevel" [compose [line-join bevel]] ][ print ["Unknown stroke-linejoin value:" val] none ] ] "stroke-linecap" [ insert tail draw-blk 'line-cap insert tail draw-blk to word! val ] ][ print ["Unknown style:" attr] ] ] ] "x" [xy/x: scale-x * val] "y" [xy/y: scale-y * val] "width" [size/x: scale-x * val] "height" [size/y: scale-y * val] "rx" [print "rx"] "ry" [radius: to decimal! val] "d" [ shape: copy [] x: none closed?: false foreach token load val [ switch/default token [ M [insert tail shape 'move] C [insert tail shape 'curve] L [insert tail shape 'line] z [closed?: true] ][ unless number? token [print ["Unknown path command:" token]] either x [insert tail shape as-pair x scale-y * token x: none] [x: scale-x * token] ] ] ] ] ] insert tail draw-blk compose [ pen (pen-color) fill-pen (fill-color) fill-rule (mode) line-width (line-width * min scale-x scale-y) ] switch command [ "rect" [ insert tail draw-blk compose [box (xy) (xy + size)] if radius [insert tail draw-blk radius] ] "path" [ unless closed? [print "Path closed"] either transf-command <> none [ switch transf-command [ "matrix" [insert tail draw-blk compose/only [ (to-word transf-command) (matrice) shape (shape) reset-matrix]] ] ][ insert tail draw-blk compose/only [shape (shape)] ] ] "g" [ print "Write here how to handle G insertion to Draw block" insert tail draw-blk probe compose/only [reset-matrix (to-word transf-command) (matrice)] ] ] ] probe defs foreach blk defs [ switch first blk [ "rect" [append-style first blk second blk] "path" [append-style first blk second blk] "g" [ print "key word" probe first blk print "matrix and style in G" probe second blk append-style first blk second blk ;print "what to draw in G" probe third blk foreach blk2 third blk [ probe blk2 switch first blk2[ "path" [append-style first blk2 second blk2] ] ] ] ] ] probe draw-blk draw-blk ] view make face [ offset: 100x100 size: 200x200 action: request-file/filter/only "*.svg" text: rejoin ["SVG Demo [" last split-path action "]"] data: read action color: white effect: compose/only [draw (load-svg data size)] edge: font: para: none feel: make feel [ detect: func [face event] [ if event/type = 'resize [ insert clear face/effect/draw load-svg face/data face/size show face ] if event/type = 'close [quit] ] ] options: [resize] ] | |
shadwolf: 23-Jun-2005 | REBOL [ Title: "SVG Demo" Owner: "Ashley G. Trüter" Version: 0.0.1 Date: 21-Jun-2005 Purpose: "Loads and displays a resizeable SVG file." History: { 0.0.1 Initial release } Notes: { Tested on very simple SVG icons Only a few basic styles / attributes / commands supported Does not handle sizes in units other than pixels (e.g. pt, in, cm, mm, etc) SVG path has an optional close command, "z" ... AGG shape equivalent auto-closes load-svg function needs to be totally refactored / optimized ... *sample only* } ] ; The following commands are available for path data: ; ; M = moveto ; L = lineto ; H = horizontal lineto ; V = vertical lineto ; C = curveto ; S = smooth curveto ; Q = quadratic Belzier curve ; T = smooth quadratic Belzier curveto ; A = elliptical Arc ; Z = closepath ;print: none ; comment out this line to enable debug messages load-svg: function [svg-file [file! string!] size [pair!]] [ id defs x y to-color to-byte draw-blk append-style svg-size scale-x scale-y ][ xml: either string? svg-file [parse-xml svg-file] [ unless %.svg = suffix? svg-file [to error! "File has an invalid suffix!"] parse-xml read svg-file ] unless xml/3/1/1 = "svg" [to error! "Could not find SVG header!"] ;unless find ["id" "xmlns"] xml/3/1/2/1 [to error! "Could not find ID header!"] ;unless xml/3/1/3/1/1 = "defs" [to error! "Could not find DEFS header!"] id: xml/3/1/2 defs: xml/3/1/3 ; ; --- Parse SVG id ; svg-size: either find ["32pt" "48pt" "72pt"] select id "width" [ switch select id "width" [ "72pt" [120x120] "48pt" [80x80] "32pt" [60x60] ] ][ as-pair to integer! any [select id "width" "100"] to integer! any [select id "height" "100"] ] x: to integer! any [select id "x" "0"] y: to integer! any [select id "y" "0"] scale-x: size/x / svg-size/x scale-y: size/y / svg-size/y ; ; --- Helper functions ; to-color: func [s [string!]] [ ; converts a string in the form "#FFFFFF" to a 4-byte tuple to tuple! load rejoin ["#{" next s "00}"] ] to-byte: func [s [string!]] [ ; converts a string with a value 0-1 to an inverted byte 255 - to integer! 255 * to decimal! s ] ; ; --- Parse SVG defs ; draw-blk: copy [] append-style: function [ command [string!] blk [block!] ][ x xy pen-color fill-color line-width mode size radius shape closed? matrix transf-command ][ xy: 0x0 size: 0x0 line-width: 1 matrice: make block! [] radius: none transf-command: none foreach [attr val] blk [ switch attr [ "transform" [print "tranform have been found" ;probe val halt val: parse val "()," transf-command: first val probe transf-command switch transf-command [ "matrix" [ foreach word val [ if not find word "matrix" [ insert tail matrice to-decimal word ] ] ] ] ] "style" [ foreach [attr val] parse val ":;" [ switch/default attr [ "font-size" [ ] "stroke" [ switch/default first val [ #"#" [pen-color: to-color val] #"n" [pen-color: none] ][ print ["Unknown stroke:" val] ] ] "stroke-width" [line-width: to decimal! val] "fill" [ fill-color: switch/default first val [ #"#" [to-color val] #"n" [none] ][ print ["Unknown fill value:" val] none ] ] "fill-rule" [ mode: switch/default val [ "evenodd" ['even-odd] ][ print ["Unknown fill-rule value:" val] none ] ] "stroke-opacity" [pen-color: any [pen-color 0.0.0.0] pen-color/4: to-byte val] "fill-opacity" [fill-color: any [fill-color 0.0.0.0] fill-color/4: to-byte val] "stroke-linejoin" [ insert tail draw-blk switch/default val [ "miter" [compose [line-join miter]] "round" [compose [line-join round]] "bevel" [compose [line-join bevel]] ][ print ["Unknown stroke-linejoin value:" val] none ] ] "stroke-linecap" [ insert tail draw-blk 'line-cap insert tail draw-blk to word! val ] ][ print ["Unknown style:" attr] ] ] ] "x" [xy/x: scale-x * val] "y" [xy/y: scale-y * val] "width" [size/x: scale-x * val] "height" [size/y: scale-y * val] "rx" [print "rx"] "ry" [radius: to decimal! val] "d" [ shape: copy [] x: none closed?: false foreach token load val [ switch/default token [ M [insert tail shape 'move] C [insert tail shape 'curve] S [insert tail shape 'curv] L [insert tail shape 'line] Q [insert tail shape 'qcurve] T [insert tail shape 'qcurv] z [closed?: true] H [insert tail shape 'hline] V [insert tail shape 'vline] A [insert tail shape 'arc] ][ unless number? token [print ["Unknown path command:" token]] either x [insert tail shape as-pair x scale-y * token x: none] [x: scale-x * token] ] ] ] ] ] insert tail draw-blk compose [ pen (pen-color) fill-pen (fill-color) fill-rule (mode) line-width (line-width * min scale-x scale-y) ] switch command [ "rect" [ insert tail draw-blk compose [box (xy) (xy + size)] if radius [insert tail draw-blk radius] ] "path" [ unless closed? [print "Path closed"] either transf-command <> none [ switch transf-command [ "matrix" [insert tail draw-blk compose/only [ (to-word transf-command) (matrice) shape (shape) reset-matrix]] ] ][ insert tail draw-blk compose/only [shape (shape)] ] ] "g" [ print "Write here how to handle G insertion to Draw block" insert tail draw-blk probe compose/only [reset-matrix (to-word transf-command) (matrice)] ] ] ] probe defs foreach blk defs [ switch first blk [ "rect" [append-style first blk second blk] "path" [append-style first blk second blk] "g" [ print "key word" probe first blk print "matrix and style in G" probe second blk append-style first blk second blk ;print "what to draw in G" probe third blk foreach blk2 third blk [ probe blk2 switch first blk2[ "path" [append-style first blk2 second blk2] ] ] ] ] ] probe draw-blk draw-blk ] view make face [ offset: 100x100 size: 200x200 action: request-file/filter/only "*.svg" text: rejoin ["SVG Demo [" last split-path action "]"] data: read action color: white effect: compose/only [draw (load-svg data size)] edge: font: para: none feel: make feel [ detect: func [face event] [ if event/type = 'resize [ insert clear face/effect/draw load-svg face/data face/size show face ] if event/type = 'close [quit] ] ] options: [resize] ] | |
shadwolf: 23-Jun-2005 | REBOL [ Title: "SVG Demo" Owner: "Ashley G. Trüter" Version: 0.0.1 Date: 21-Jun-2005 Purpose: "Loads and displays a resizeable SVG file." History: { 0.0.1 Initial release } Notes: { Tested on very simple SVG icons Only a few basic styles / attributes / commands supported Does not handle sizes in units other than pixels (e.g. pt, in, cm, mm, etc) SVG path has an optional close command, "z" ... AGG shape equivalent auto-closes load-svg function needs to be totally refactored / optimized ... *sample only* } ] ; The following commands are available for path data: ; ; M = moveto ; L = lineto ; H = horizontal lineto ; V = vertical lineto ; C = curveto ; S = smooth curveto ; Q = quadratic Belzier curve ; T = smooth quadratic Belzier curveto ; A = elliptical Arc ; Z = closepath ;print: none ; comment out this line to enable debug messages load-svg: function [svg-file [file! string!] size [pair!]] [ id defs x y to-color to-byte draw-blk append-style svg-size scale-x scale-y ][ xml: either string? svg-file [parse-xml svg-file] [ unless %.svg = suffix? svg-file [to error! "File has an invalid suffix!"] parse-xml read svg-file ] unless xml/3/1/1 = "svg" [to error! "Could not find SVG header!"] ;unless find ["id" "xmlns"] xml/3/1/2/1 [to error! "Could not find ID header!"] ;unless xml/3/1/3/1/1 = "defs" [to error! "Could not find DEFS header!"] id: xml/3/1/2 defs: xml/3/1/3 ; ; --- Parse SVG id ; svg-size: either find ["32pt" "48pt" "72pt"] select id "width" [ switch select id "width" [ "72pt" [120x120] "48pt" [80x80] "32pt" [60x60] ] ][ as-pair to integer! any [select id "width" "100"] to integer! any [select id "height" "100"] ] x: to integer! any [select id "x" "0"] y: to integer! any [select id "y" "0"] scale-x: size/x / svg-size/x scale-y: size/y / svg-size/y ; ; --- Helper functions ; to-color: func [s [string!]] [ ; converts a string in the form "#FFFFFF" to a 4-byte tuple to tuple! load rejoin ["#{" next s "00}"] ] to-byte: func [s [string!]] [ ; converts a string with a value 0-1 to an inverted byte 255 - to integer! 255 * to decimal! s ] ; ; --- Parse SVG defs ; draw-blk: copy [] append-style: function [ command [string!] blk [block!] ][ x xy pen-color fill-color line-width mode size radius shape closed? matrix transf-command ][ xy: 0x0 size: 0x0 line-width: 1 matrice: make block! [] radius: none transf-command: none foreach [attr val] blk [ switch attr [ "transform" [print "tranform have been found" ;probe val halt val: parse val "()," transf-command: first val probe transf-command switch transf-command [ "matrix" [ foreach word val [ if not find word "matrix" [ insert tail matrice to-decimal word ] ] ] ] ] "style" [ foreach [attr val] parse val ":;" [ switch/default attr [ "font-size" [ ] "stroke" [ switch/default first val [ #"#" [pen-color: to-color val] #"n" [pen-color: none] ][ print ["Unknown stroke:" val] ] ] "stroke-width" [line-width: to decimal! val] "fill" [ fill-color: switch/default first val [ #"#" [to-color val] #"n" [none] ][ print ["Unknown fill value:" val] none ] ] "fill-rule" [ mode: switch/default val [ "evenodd" ['even-odd] ][ print ["Unknown fill-rule value:" val] none ] ] "stroke-opacity" [pen-color: any [pen-color 0.0.0.0] pen-color/4: to-byte val] "fill-opacity" [fill-color: any [fill-color 0.0.0.0] fill-color/4: to-byte val] "stroke-linejoin" [ insert tail draw-blk switch/default val [ "miter" [compose [line-join miter]] "round" [compose [line-join round]] "bevel" [compose [line-join bevel]] ][ print ["Unknown stroke-linejoin value:" val] none ] ] "stroke-linecap" [ insert tail draw-blk 'line-cap insert tail draw-blk to word! val ] ][ print ["Unknown style:" attr] ] ] ] "x" [xy/x: scale-x * val] "y" [xy/y: scale-y * val] "width" [size/x: scale-x * val] "height" [size/y: scale-y * val] "rx" [print "rx"] "ry" [radius: to decimal! val] "d" [ shape: copy [] x: none closed?: false if all [x not number? token] [ insert tail shape x * either token = 'V [scale-y][scale-x] x: none ] foreach token load val [ switch/default token [ M [insert tail shape 'move] C [insert tail shape 'curve] S [insert tail shape 'curv] L [insert tail shape 'line] Q [insert tail shape 'qcurve] T [insert tail shape 'qcurv] z [closed?: true] H [insert tail shape 'hline] V [insert tail shape 'vline] A [insert tail shape 'arc] ][ unless number? token [print ["Unknown path command:" token]] either x [insert tail shape as-pair x scale-y * token x: none] [x: scale-x * token] ] ] ] ] ] insert tail draw-blk compose [ pen (pen-color) fill-pen (fill-color) fill-rule (mode) line-width (line-width * min scale-x scale-y) ] switch command [ "rect" [ insert tail draw-blk compose [box (xy) (xy + size)] if radius [insert tail draw-blk radius] ] "path" [ unless closed? [print "Path closed"] either transf-command <> none [ switch transf-command [ "matrix" [insert tail draw-blk compose/only [ (to-word transf-command) (matrice) shape (shape) reset-matrix]] ] ][ insert tail draw-blk compose/only [shape (shape)] ] ] "g" [ print "Write here how to handle G insertion to Draw block" insert tail draw-blk probe compose/only [reset-matrix (to-word transf-command) (matrice)] ] ] ] probe defs foreach blk defs [ switch first blk [ "rect" [append-style first blk second blk] "path" [append-style first blk second blk] "g" [ print "key word" probe first blk print "matrix and style in G" probe second blk append-style first blk second blk ;print "what to draw in G" probe third blk foreach blk2 third blk [ probe blk2 switch first blk2[ "path" [append-style first blk2 second blk2] ] ] ] ] ] probe draw-blk draw-blk ] view make face [ offset: 100x100 size: 200x200 action: request-file/filter/only "*.svg" text: rejoin ["SVG Demo [" last split-path action "]"] data: read action color: white effect: compose/only [draw (load-svg data size)] edge: font: para: none feel: make feel [ detect: func [face event] [ if event/type = 'resize [ insert clear face/effect/draw load-svg face/data face/size show face ] if event/type = 'close [quit] ] ] options: [resize] ] | |
Group: !REBOL3-OLD1 ... [web-public] | ||
BrianH: 13-Feb-2007 | I meant style I suppose, though even C is expression-based. The idioms would actually be more assembler-like than C-like, for 2-address instruction sets like x86. Still, this wouldn't add anything to the language that isn't there through other means, except speed. And while it wouldn't complicate the interpreter, it would complicate the semantics of REBOL, making it harder to explain, debug or reimplement. | |
Group: !Cheyenne ... Discussions about the Cheyenne Web Server [web-public] | ||
MikeL: 15-Jun-2007 | webapp [ virtual-root "/cgi-bin" root-dir %/c/xitami/cgi-bin/ debug ] | |
Pekr: 5-Jul-2007 | modules [ ; userdir internal static action fastcgi rsp ssi alias ; embed ] globals [ bind SSI to [.shtml .shtm] bind fastcgi to [.php .php3 .php4] bind-extern CGI to [.cgi .r] bind-extern RSP to [.j .rsp] ; user nobody ; group nobody ] default [ root-dir %/c/!Docs-private/Xidys/cheyenne-r0914/Cheyenne/www/ default [%index.html %index.rsp %index.php] on-status-code [ 404 "/custom404.html" ] webapp [ virtual-root "/testapp" root-dir %www/testapp/ auth "/testapp/login.rsp" debug ] ; "/" [ ; redirect http://softinnov.org ; ] ; extern fastcgi [ ; command "php -b $port" ; pool min 1 max 4 ; server 127.0.0.1 ; port 1234 ; root-dir "/home/dk/fcgi/" ; ] ] ;rebol.si.org [ ; root-dir %//dev/si-org/old/ ; default %main.html ; ; redirect 301 "/mysql*" "http://si.org/rebol/mysql.shtml" ; redirect 301 "/rebox*" "http://si.org/rebol/rebox.shtml" ; redirect 301 "/" "http://si.org" ;] ; ### ; To add a new virtual host just duplicate and fill the following ; example host : ; ; my.vhost.com [ ; root-dir %/www/ ; documents root directory ; default [...] ; default files ; ] ; ### | |
GrahamC: 29-Dec-2010 | Given this JS if ( bValid ) { var dataString = 'pain=' + pain + '&ptgl=' + gs + '&fn=' + fn + '&rapid3=' + rapid3 + '&fatigue=' + fatigue + '&ros=' + ros + '&ems=' + ems + '&patient=' + '<%=patient%>' ; //alert (dataString);return false; $.ajax({ type: "POST", url: "add-rapid3.rsp", data: dataString, success: function() { // removed ... } }); return false; //$( this ).dialog( "close" ); } }, what would cause this? 28/12-23:58:37.055-[DEBUG] c: [pain "[object Object]" ptgl "[object Object]" fn "[object Object]" rapid3 "[object Object]" fatigue "[object Object]" ros "[object HTMLInputElement]" ems "[object Object]" patient "7"] where the add-rapid3.rsp is <% ; add-rapid3.rsp c: request/content ?? c exit %> | |
GrahamC: 29-Dec-2010 | and I'm getting this error in trace.log 9/12-01:14:18.696-[DEBUG] c: [pain "9" ptgl "8" fn "10" rapid3 "7" fatigue "4" ros "6" ems "5" patient "7"] 29/12-01:14:18.696-[RSP] ##RSP Script Error: URL = /md/add-rapid3.rsp File = /r/pwp/www/md/add-rapid3.rsp ** Script Error : patient has no value ** Where: context ** Near: [patient] | |
Group: !REBOL3 Schemes ... Implementors guide [web-public] | ||
Andreas: 17-Jan-2010 | -c is for client mode, i.e. so that stunnel will connect to a server -f is so that stunnel stays in the foreground (and you see debug output) -P '' is to avoid creating a pid file (dunno if that is necessary on win32 stunnels) -d sourceport tells stunnel to listen on sourceport -r targethost:targetport to forward data to this target | |
Group: Red ... Red language group [web-public] | ||
BrianH: 27-Feb-2011 | I prefer code that can be loaded by a dumb loader, code that doesn't have different meanings depending on which module is loaded even before the code runs. I've had a lot of experience with different languages, and any language which requires you to read the source of its entire runtime library to debug properly is a bad one (I'm looking at you, Delphi and C++). |